package com.boyon.web.servlet.tomcat;

import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;

import com.boyon.common.exection.SystemException;

/**
 * ClassName:TomcatSessionFace <br/>
 * Function: tomcat session 装饰器类. <br/>
 * Date: 2018年3月26日 下午10:13:45 <br/>
 * 
 * @author sunshulin
 * @version
 * @since JDK 1.8
 * @see
 */
@SuppressWarnings("deprecation")
public class TomcatSessionFace implements HttpSession {

	private final HttpSession session;

	/**
	 * Creates a new instance of TomcatSessionFace.
	 * 
	 * @param session
	 */
	public TomcatSessionFace(HttpSession session) {
		super();
		this.session = session;
	}

	/**
	 * 
	 * 
	 * @see javax.servlet.http.HttpSession#getSessionContext()
	 */
	public HttpSessionContext getSessionContext() {
		throw SystemException.builder(0, "getSessionContext方法已废弃");
	}

	/**
	 * 
	 * 
	 * @see javax.servlet.http.HttpSession#getValue(java.lang.String)
	 */
	public Object getValue(String name) {
		throw SystemException.builder(0, "getValue方法已废弃");
	}

	/**
	 * 
	 * 
	 * @see javax.servlet.http.HttpSession#getValueNames()
	 */
	public String[] getValueNames() {
		throw SystemException.builder(0, "getValueNames方法已废弃");
	}

	/**
	 * 
	 * 
	 * @see javax.servlet.http.HttpSession#putValue(java.lang.String,
	 *      java.lang.Object)
	 */
	public void putValue(String name, Object value) {
		throw SystemException.builder(0, "putValue方法已废弃");
	}

	/**
	 * 
	 * 
	 * @see javax.servlet.http.HttpSession#removeValue(java.lang.String)
	 */
	public void removeValue(String name) {
		throw SystemException.builder(0, "removeValue方法已废弃");
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getCreationTime()
	 */
	public long getCreationTime() {
		return session.getCreationTime();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getId()
	 */
	public String getId() {
		return session.getId();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getLastAccessedTime()
	 */
	public long getLastAccessedTime() {
		return session.getLastAccessedTime();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getServletContext()
	 */
	public ServletContext getServletContext() {
		return session.getServletContext();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#setMaxInactiveInterval(int)
	 */
	public void setMaxInactiveInterval(int interval) {
		session.setMaxInactiveInterval(interval);
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getMaxInactiveInterval()
	 */
	public int getMaxInactiveInterval() {
		return session.getMaxInactiveInterval();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getAttribute(java.lang.String)
	 */
	public Object getAttribute(String name) {
		return session.getAttribute(name);
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#getAttributeNames()
	 */
	public Enumeration<String> getAttributeNames() {
		return session.getAttributeNames();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#setAttribute(java.lang.String,
	 *      java.lang.Object)
	 */
	public void setAttribute(String name, Object value) {
		session.setAttribute(name, value);
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#removeAttribute(java.lang.String)
	 */
	public void removeAttribute(String name) {
		session.removeAttribute(name);
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#invalidate()
	 */
	public void invalidate() {
		session.invalidate();
	}

	/**
	 * 
	 * @see javax.servlet.http.HttpSession#isNew()
	 */
	public boolean isNew() {
		return session.isNew();
	}

}
